import { Button } from "antd";
import { typeEnum } from "@/assets/common/enums";

interface SurveyMenuType {
  insert?: boolean;
  type?: string;
  insertClick?: () => void;
  editClick?: () => void;
  copyClick?: () => void;
  erasureClick?: () => void;
  moveClick?: (type: string) => void;
}
export default function SurveyMenu({
  insert = false,
  type = typeEnum.PAGING,
  insertClick = () => {},
  editClick = () => {},
  copyClick = () => {},
  erasureClick = () => {},
  moveClick = () => {}
}: SurveyMenuType) {
  return (
    <div className="survey-menu">
      <div className="survey-menu-box">
        <span className="survey-insert" onClick={insertClick}>
          {insert ? "在此题后插入新题" : "插入题目"}
        </span>
        <div className="menu-buttom">
          {type !== typeEnum.PAGING && (
            <>
              <Button type="primary" ghost size="small" onClick={editClick}>
                编辑
              </Button>
              <Button type="primary" ghost size="small" onClick={copyClick}>
                复制
              </Button>
            </>
          )}
          <Button type="primary" ghost size="small" onClick={erasureClick}>
            删除
          </Button>
          <Button type="primary" ghost size="small" onClick={() => moveClick("上")}>
            上移
          </Button>
          <Button type="primary" ghost size="small" onClick={() => moveClick("下")}>
            下移
          </Button>
          <Button type="primary" ghost size="small" onClick={() => moveClick("前")}>
            最前
          </Button>
          <Button type="primary" ghost size="small" onClick={() => moveClick("后")}>
            最后
          </Button>
        </div>
      </div>
    </div>
  );
}
